package symbol;

import java.util.ArrayList;

public class FuncParamsTypeList {
	// 某一变量的参数列表
	// int_2代表int的2维数组
	public ArrayList<String> typeList = new ArrayList<String>();
	public String returnType;
	
	@Override
    public boolean equals(Object o) {
        //自反性
        if (this == o) return true;
        //任何对象不等于null，比较是否为同一类型
        if (!(o instanceof FuncParamsTypeList)) return false;
        //强制类型转换
        FuncParamsTypeList person = (FuncParamsTypeList) o;
        //比较属性值
        if (this.typeList.size() != person.typeList.size()) return false;
        else {
        	for (int i = 0;i < this.typeList.size();i++) {
        		if (this.typeList.get(i) != person.typeList.get(i)) return false;
        	}
        	return true;
        }
    }
	
	public String toString() {
		String result = "";
		for (String s : this.typeList) {
			result += s + "_";
		}
		result = result.replace("<", "_");
		result = result.replace(">", "");
		return result;
	}
	
	public FuncParamsTypeList(ArrayList<String> paramTypeList, String returnType) {
		this.returnType = returnType;
		this.typeList = new ArrayList<>(paramTypeList);
	}
	
	public FuncParamsTypeList(ArrayList<String> paramTypeList) {
		this.typeList = new ArrayList<>(paramTypeList);
	}
}
